{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1、绘制基本图形"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"https://bokeh.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"1001\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(root) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n",
       "    root._bokeh_onload_callbacks = [];\n",
       "    root._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "  var JS_MIME_TYPE = 'application/javascript';\n",
       "  var HTML_MIME_TYPE = 'text/html';\n",
       "  var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
       "  var CLASS_NAME = 'output_bokeh rendered_html';\n",
       "\n",
       "  /**\n",
       "   * Render data to the DOM node\n",
       "   */\n",
       "  function render(props, node) {\n",
       "    var script = document.createElement(\"script\");\n",
       "    node.appendChild(script);\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when an output is cleared or removed\n",
       "   */\n",
       "  function handleClearOutput(event, handle) {\n",
       "    var cell = handle.cell;\n",
       "\n",
       "    var id = cell.output_area._bokeh_element_id;\n",
       "    var server_id = cell.output_area._bokeh_server_id;\n",
       "    // Clean up Bokeh references\n",
       "    if (id != null && id in Bokeh.index) {\n",
       "      Bokeh.index[id].model.document.clear();\n",
       "      delete Bokeh.index[id];\n",
       "    }\n",
       "\n",
       "    if (server_id !== undefined) {\n",
       "      // Clean up Bokeh references\n",
       "      var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
       "      cell.notebook.kernel.execute(cmd, {\n",
       "        iopub: {\n",
       "          output: function(msg) {\n",
       "            var id = msg.content.text.trim();\n",
       "            if (id in Bokeh.index) {\n",
       "              Bokeh.index[id].model.document.clear();\n",
       "              delete Bokeh.index[id];\n",
       "            }\n",
       "          }\n",
       "        }\n",
       "      });\n",
       "      // Destroy server and session\n",
       "      var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
       "      cell.notebook.kernel.execute(cmd);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when a new output is added\n",
       "   */\n",
       "  function handleAddOutput(event, handle) {\n",
       "    var output_area = handle.output_area;\n",
       "    var output = handle.output;\n",
       "\n",
       "    // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
       "    if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
       "      return\n",
       "    }\n",
       "\n",
       "    var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
       "\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
       "      toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
       "      // store reference to embed id on output_area\n",
       "      output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
       "    }\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
       "      var bk_div = document.createElement(\"div\");\n",
       "      bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
       "      var script_attrs = bk_div.children[0].attributes;\n",
       "      for (var i = 0; i < script_attrs.length; i++) {\n",
       "        toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
       "        toinsert[toinsert.length - 1].firstChild.textContent = bk_div.children[0].textContent\n",
       "      }\n",
       "      // store reference to server id on output_area\n",
       "      output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
       "    }\n",
       "  }\n",
       "\n",
       "  function register_renderer(events, OutputArea) {\n",
       "\n",
       "    function append_mime(data, metadata, element) {\n",
       "      // create a DOM node to render to\n",
       "      var toinsert = this.create_output_subarea(\n",
       "        metadata,\n",
       "        CLASS_NAME,\n",
       "        EXEC_MIME_TYPE\n",
       "      );\n",
       "      this.keyboard_manager.register_events(toinsert);\n",
       "      // Render to node\n",
       "      var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
       "      render(props, toinsert[toinsert.length - 1]);\n",
       "      element.append(toinsert);\n",
       "      return toinsert\n",
       "    }\n",
       "\n",
       "    /* Handle when an output is cleared or removed */\n",
       "    events.on('clear_output.CodeCell', handleClearOutput);\n",
       "    events.on('delete.Cell', handleClearOutput);\n",
       "\n",
       "    /* Handle when a new output is added */\n",
       "    events.on('output_added.OutputArea', handleAddOutput);\n",
       "\n",
       "    /**\n",
       "     * Register the mime type and append_mime function with output_area\n",
       "     */\n",
       "    OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
       "      /* Is output safe? */\n",
       "      safe: true,\n",
       "      /* Index of renderer in `output_area.display_order` */\n",
       "      index: 0\n",
       "    });\n",
       "  }\n",
       "\n",
       "  // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
       "  if (root.Jupyter !== undefined) {\n",
       "    var events = require('base/js/events');\n",
       "    var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
       "\n",
       "    if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
       "      register_renderer(events, OutputArea);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  \n",
       "  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    root._bokeh_timeout = Date.now() + 5000;\n",
       "    root._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    var el = document.getElementById(\"1001\");\n",
       "    if (el != null) {\n",
       "      el.textContent = \"BokehJS is loading...\";\n",
       "    }\n",
       "    if (root.Bokeh !== undefined) {\n",
       "      if (el != null) {\n",
       "        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
       "      }\n",
       "    } else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "\n",
       "  function run_callbacks() {\n",
       "    try {\n",
       "      root._bokeh_onload_callbacks.forEach(function(callback) {\n",
       "        if (callback != null)\n",
       "          callback();\n",
       "      });\n",
       "    } finally {\n",
       "      delete root._bokeh_onload_callbacks\n",
       "    }\n",
       "    console.debug(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(css_urls, js_urls, callback) {\n",
       "    if (css_urls == null) css_urls = [];\n",
       "    if (js_urls == null) js_urls = [];\n",
       "\n",
       "    root._bokeh_onload_callbacks.push(callback);\n",
       "    if (root._bokeh_is_loading > 0) {\n",
       "      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    root._bokeh_is_loading = css_urls.length + js_urls.length;\n",
       "\n",
       "    function on_load() {\n",
       "      root._bokeh_is_loading--;\n",
       "      if (root._bokeh_is_loading === 0) {\n",
       "        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n",
       "        run_callbacks()\n",
       "      }\n",
       "    }\n",
       "\n",
       "    function on_error() {\n",
       "      console.error(\"failed to load \" + url);\n",
       "    }\n",
       "\n",
       "    for (var i = 0; i < css_urls.length; i++) {\n",
       "      var url = css_urls[i];\n",
       "      const element = document.createElement(\"link\");\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error;\n",
       "      element.rel = \"stylesheet\";\n",
       "      element.type = \"text/css\";\n",
       "      element.href = url;\n",
       "      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n",
       "      document.body.appendChild(element);\n",
       "    }\n",
       "\n",
       "    const hashes = {\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\": \"kLr4fYcqcSpbuI95brIH3vnnYCquzzSxHPU6XGQCIkQRGJwhg0StNbj1eegrHs12\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\": \"xIGPmVtaOm+z0BqfSOMn4lOR6ciex448GIKG4eE61LsAvmGj48XcMQZtKcE/UXZe\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\": \"Dc9u1wF/0zApGIWoBbH77iWEHtdmkuYWG839Uzmv8y8yBLXebjO9ZnERsde5Ln/P\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\": \"cT9JaBz7GiRXdENrJLZNSC6eMNF3nh3fa5fTF51Svp+ukxPdwcU5kGXGPBgDCa2j\"};\n",
       "\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var element = document.createElement('script');\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error;\n",
       "      element.async = false;\n",
       "      element.src = url;\n",
       "      if (url in hashes) {\n",
       "        element.crossOrigin = \"anonymous\";\n",
       "        element.integrity = \"sha384-\" + hashes[url];\n",
       "      }\n",
       "      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.head.appendChild(element);\n",
       "    }\n",
       "  };\n",
       "\n",
       "  function inject_raw_css(css) {\n",
       "    const element = document.createElement(\"style\");\n",
       "    element.appendChild(document.createTextNode(css));\n",
       "    document.body.appendChild(element);\n",
       "  }\n",
       "\n",
       "  \n",
       "  var js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\"];\n",
       "  var css_urls = [];\n",
       "  \n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "    \n",
       "    \n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if (root.Bokeh !== undefined || force === true) {\n",
       "      \n",
       "    for (var i = 0; i < inline_js.length; i++) {\n",
       "      inline_js[i].call(root, root.Bokeh);\n",
       "    }\n",
       "    if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!root._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      root._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(\"1001\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (root._bokeh_is_loading === 0) {\n",
       "    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(css_urls, js_urls, function() {\n",
       "      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(window));"
      ],
      "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n  function now() {\n    return new Date();\n  }\n\n  var force = true;\n\n  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n    root._bokeh_onload_callbacks = [];\n    root._bokeh_is_loading = undefined;\n  }\n\n  \n\n  \n  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n    root._bokeh_timeout = Date.now() + 5000;\n    root._bokeh_failed_load = false;\n  }\n\n  var NB_LOAD_WARNING = {'data': {'text/html':\n     \"<div style='background-color: #fdd'>\\n\"+\n     \"<p>\\n\"+\n     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n     \"</p>\\n\"+\n     \"<ul>\\n\"+\n     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n     \"</ul>\\n\"+\n     \"<code>\\n\"+\n     \"from bokeh.resources import INLINE\\n\"+\n     \"output_notebook(resources=INLINE)\\n\"+\n     \"</code>\\n\"+\n     \"</div>\"}};\n\n  function display_loaded() {\n    var el = document.getElementById(\"1001\");\n    if (el != null) {\n      el.textContent = \"BokehJS is loading...\";\n    }\n    if (root.Bokeh !== undefined) {\n      if (el != null) {\n        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n      }\n    } else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(display_loaded, 100)\n    }\n  }\n\n\n  function run_callbacks() {\n    try {\n      root._bokeh_onload_callbacks.forEach(function(callback) {\n        if (callback != null)\n          callback();\n      });\n    } finally {\n      delete root._bokeh_onload_callbacks\n    }\n    console.debug(\"Bokeh: all callbacks have finished\");\n  }\n\n  function load_libs(css_urls, js_urls, callback) {\n    if (css_urls == null) css_urls = [];\n    if (js_urls == null) js_urls = [];\n\n    root._bokeh_onload_callbacks.push(callback);\n    if (root._bokeh_is_loading > 0) {\n      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n      return null;\n    }\n    if (js_urls == null || js_urls.length === 0) {\n      run_callbacks();\n      return null;\n    }\n    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n    root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n    function on_load() {\n      root._bokeh_is_loading--;\n      if (root._bokeh_is_loading === 0) {\n        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n        run_callbacks()\n      }\n    }\n\n    function on_error() {\n      console.error(\"failed to load \" + url);\n    }\n\n    for (var i = 0; i < css_urls.length; i++) {\n      var url = css_urls[i];\n      const element = document.createElement(\"link\");\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.rel = \"stylesheet\";\n      element.type = \"text/css\";\n      element.href = url;\n      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n      document.body.appendChild(element);\n    }\n\n    const hashes = {\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\": \"kLr4fYcqcSpbuI95brIH3vnnYCquzzSxHPU6XGQCIkQRGJwhg0StNbj1eegrHs12\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\": \"xIGPmVtaOm+z0BqfSOMn4lOR6ciex448GIKG4eE61LsAvmGj48XcMQZtKcE/UXZe\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\": \"Dc9u1wF/0zApGIWoBbH77iWEHtdmkuYWG839Uzmv8y8yBLXebjO9ZnERsde5Ln/P\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\": \"cT9JaBz7GiRXdENrJLZNSC6eMNF3nh3fa5fTF51Svp+ukxPdwcU5kGXGPBgDCa2j\"};\n\n    for (var i = 0; i < js_urls.length; i++) {\n      var url = js_urls[i];\n      var element = document.createElement('script');\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.async = false;\n      element.src = url;\n      if (url in hashes) {\n        element.crossOrigin = \"anonymous\";\n        element.integrity = \"sha384-\" + hashes[url];\n      }\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      document.head.appendChild(element);\n    }\n  };\n\n  function inject_raw_css(css) {\n    const element = document.createElement(\"style\");\n    element.appendChild(document.createTextNode(css));\n    document.body.appendChild(element);\n  }\n\n  \n  var js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\"];\n  var css_urls = [];\n  \n\n  var inline_js = [\n    function(Bokeh) {\n      Bokeh.set_log_level(\"info\");\n    },\n    function(Bokeh) {\n    \n    \n    }\n  ];\n\n  function run_inline_js() {\n    \n    if (root.Bokeh !== undefined || force === true) {\n      \n    for (var i = 0; i < inline_js.length; i++) {\n      inline_js[i].call(root, root.Bokeh);\n    }\n    if (force === true) {\n        display_loaded();\n      }} else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(run_inline_js, 100);\n    } else if (!root._bokeh_failed_load) {\n      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n      root._bokeh_failed_load = true;\n    } else if (force !== true) {\n      var cell = $(document.getElementById(\"1001\")).parents('.cell').data().cell;\n      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n    }\n\n  }\n\n  if (root._bokeh_is_loading === 0) {\n    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n    run_inline_js();\n  } else {\n    load_libs(css_urls, js_urls, function() {\n      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n      run_inline_js();\n    });\n  }\n}(window));"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "from bokeh.plotting import figure, show, output_notebook\n",
    "from bokeh.layouts import gridplot\n",
    "output_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "N = 9\n",
    "x = np.linspace(-2,2,N)  #序列生成器\n",
    "y = x**2\n",
    "sizes = np.linspace(10,20,N)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([10.  , 11.25, 12.5 , 13.75, 15.  , 16.25, 17.5 , 18.75, 20.  ])"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sizes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "figures = []# 图形列表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "p = figure(title=\"圆形\",plot_width=200,plot_height=200)\n",
    "p.circle(x,y,radius=0.1,color=\"#3288bd\")\n",
    "#show(p)\n",
    "figures.append(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "p = figure(title=\"三角形\",plot_width=200,plot_height=200)  # 设置图表图形\n",
    "p.scatter(x,y,marker=\"triangle\",size=sizes,color=\"#99d594\",line_width=2)\n",
    "#show(p)\n",
    "figures.append(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"21c89374-b10e-42b6-b7c3-92c40cd1b9c9\" data-root-id=\"2246\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"0d199c12-53e6-43de-b83a-64a1116c0e7d\":{\"roots\":{\"references\":[{\"attributes\":{\"children\":[{\"id\":\"2245\"},{\"id\":\"2243\"}]},\"id\":\"2246\",\"type\":\"Column\"},{\"attributes\":{\"below\":[{\"id\":\"2160\"}],\"center\":[{\"id\":\"2163\"},{\"id\":\"2167\"}],\"left\":[{\"id\":\"2164\"}],\"plot_height\":200,\"plot_width\":200,\"renderers\":[{\"id\":\"2185\"}],\"title\":{\"id\":\"2150\"},\"toolbar\":{\"id\":\"2175\"},\"toolbar_location\":null,\"x_range\":{\"id\":\"2152\"},\"x_scale\":{\"id\":\"2156\"},\"y_range\":{\"id\":\"2154\"},\"y_scale\":{\"id\":\"2158\"}},\"id\":\"2149\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"2206\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"2171\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"2194\",\"type\":\"LinearScale\"},{\"attributes\":{\"data_source\":{\"id\":\"2220\"},\"glyph\":{\"id\":\"2221\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"2222\"},\"selection_glyph\":null,\"view\":{\"id\":\"2224\"}},\"id\":\"2223\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"2168\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"2190\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"2192\",\"type\":\"DataRange1d\"},{\"attributes\":{\"formatter\":{\"id\":\"2228\"},\"ticker\":{\"id\":\"2161\"}},\"id\":\"2160\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"2237\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"2240\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"2239\",\"type\":\"Selection\"},{\"attributes\":{\"axis\":{\"id\":\"2202\"},\"dimension\":1,\"ticker\":null},\"id\":\"2205\",\"type\":\"Grid\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"2206\"},{\"id\":\"2207\"},{\"id\":\"2208\"},{\"id\":\"2209\"},{\"id\":\"2210\"},{\"id\":\"2211\"}]},\"id\":\"2213\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"2169\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"2152\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"2154\",\"type\":\"DataRange1d\"},{\"attributes\":{\"formatter\":{\"id\":\"2235\"},\"ticker\":{\"id\":\"2203\"}},\"id\":\"2202\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"2226\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"data\":{\"size\":{\"__ndarray__\":\"AAAAAAAAJEAAAAAAAIAmQAAAAAAAAClAAAAAAACAK0AAAAAAAAAuQAAAAAAAQDBAAAAAAACAMUAAAAAAAMAyQAAAAAAAADRA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[9]},\"x\":{\"__ndarray__\":\"AAAAAAAAAMAAAAAAAAD4vwAAAAAAAPC/AAAAAAAA4L8AAAAAAAAAAAAAAAAAAOA/AAAAAAAA8D8AAAAAAAD4PwAAAAAAAABA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[9]},\"y\":{\"__ndarray__\":\"AAAAAAAAEEAAAAAAAAACQAAAAAAAAPA/AAAAAAAA0D8AAAAAAAAAAAAAAAAAANA/AAAAAAAA8D8AAAAAAAACQAAAAAAAABBA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[9]}},\"selected\":{\"id\":\"2239\"},\"selection_policy\":{\"id\":\"2240\"}},\"id\":\"2220\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"2158\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"2172\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"2165\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"2199\",\"type\":\"BasicTicker\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#3288bd\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#3288bd\"},\"radius\":{\"units\":\"data\",\"value\":0.1},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2184\",\"type\":\"Circle\"},{\"attributes\":{\"formatter\":{\"id\":\"2237\"},\"ticker\":{\"id\":\"2199\"}},\"id\":\"2198\",\"type\":\"LinearAxis\"},{\"attributes\":{\"data_source\":{\"id\":\"2182\"},\"glyph\":{\"id\":\"2183\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"2184\"},\"selection_glyph\":null,\"view\":{\"id\":\"2186\"}},\"id\":\"2185\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"2196\",\"type\":\"LinearScale\"},{\"attributes\":{\"source\":{\"id\":\"2220\"}},\"id\":\"2224\",\"type\":\"CDSView\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"2174\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"toolbars\":[{\"id\":\"2175\"},{\"id\":\"2213\"}],\"tools\":[{\"id\":\"2168\"},{\"id\":\"2169\"},{\"id\":\"2170\"},{\"id\":\"2171\"},{\"id\":\"2172\"},{\"id\":\"2173\"},{\"id\":\"2206\"},{\"id\":\"2207\"},{\"id\":\"2208\"},{\"id\":\"2209\"},{\"id\":\"2210\"},{\"id\":\"2211\"}]},\"id\":\"2244\",\"type\":\"ProxyToolbar\"},{\"attributes\":{\"children\":[[{\"id\":\"2149\"},0,0],[{\"id\":\"2187\"},0,1]]},\"id\":\"2243\",\"type\":\"GridBox\"},{\"attributes\":{\"text\":\"\\u4e09\\u89d2\\u5f62\"},\"id\":\"2188\",\"type\":\"Title\"},{\"attributes\":{\"source\":{\"id\":\"2182\"}},\"id\":\"2186\",\"type\":\"CDSView\"},{\"attributes\":{\"overlay\":{\"id\":\"2174\"}},\"id\":\"2170\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"2203\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"2209\",\"type\":\"SaveTool\"},{\"attributes\":{\"axis\":{\"id\":\"2160\"},\"ticker\":null},\"id\":\"2163\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"2161\",\"type\":\"BasicTicker\"},{\"attributes\":{\"data\":{\"x\":{\"__ndarray__\":\"AAAAAAAAAMAAAAAAAAD4vwAAAAAAAPC/AAAAAAAA4L8AAAAAAAAAAAAAAAAAAOA/AAAAAAAA8D8AAAAAAAD4PwAAAAAAAABA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[9]},\"y\":{\"__ndarray__\":\"AAAAAAAAEEAAAAAAAAACQAAAAAAAAPA/AAAAAAAA0D8AAAAAAAAAAAAAAAAAANA/AAAAAAAA8D8AAAAAAAACQAAAAAAAABBA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[9]}},\"selected\":{\"id\":\"2230\"},\"selection_policy\":{\"id\":\"2231\"}},\"id\":\"2182\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"2235\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"axis\":{\"id\":\"2198\"},\"ticker\":null},\"id\":\"2201\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"2228\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"below\":[{\"id\":\"2198\"}],\"center\":[{\"id\":\"2201\"},{\"id\":\"2205\"}],\"left\":[{\"id\":\"2202\"}],\"plot_height\":200,\"plot_width\":200,\"renderers\":[{\"id\":\"2223\"}],\"title\":{\"id\":\"2188\"},\"toolbar\":{\"id\":\"2213\"},\"toolbar_location\":null,\"x_range\":{\"id\":\"2190\"},\"x_scale\":{\"id\":\"2194\"},\"y_range\":{\"id\":\"2192\"},\"y_scale\":{\"id\":\"2196\"}},\"id\":\"2187\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"2207\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"formatter\":{\"id\":\"2226\"},\"ticker\":{\"id\":\"2165\"}},\"id\":\"2164\",\"type\":\"LinearAxis\"},{\"attributes\":{\"fill_color\":{\"value\":\"#99d594\"},\"line_color\":{\"value\":\"#99d594\"},\"line_width\":{\"value\":2},\"marker\":{\"value\":\"triangle\"},\"size\":{\"field\":\"size\",\"units\":\"screen\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2221\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"2211\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"2156\",\"type\":\"LinearScale\"},{\"attributes\":{\"overlay\":{\"id\":\"2212\"}},\"id\":\"2208\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"text\":\"\\u5706\\u5f62\"},\"id\":\"2150\",\"type\":\"Title\"},{\"attributes\":{\"fill_color\":{\"value\":\"#3288bd\"},\"line_color\":{\"value\":\"#3288bd\"},\"radius\":{\"units\":\"data\",\"value\":0.1},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2183\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"2231\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"axis\":{\"id\":\"2164\"},\"dimension\":1,\"ticker\":null},\"id\":\"2167\",\"type\":\"Grid\"},{\"attributes\":{\"toolbar\":{\"id\":\"2244\"},\"toolbar_location\":\"above\"},\"id\":\"2245\",\"type\":\"ToolbarBox\"},{\"attributes\":{},\"id\":\"2210\",\"type\":\"ResetTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"2168\"},{\"id\":\"2169\"},{\"id\":\"2170\"},{\"id\":\"2171\"},{\"id\":\"2172\"},{\"id\":\"2173\"}]},\"id\":\"2175\",\"type\":\"Toolbar\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#99d594\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#99d594\"},\"line_width\":{\"value\":2},\"marker\":{\"value\":\"triangle\"},\"size\":{\"field\":\"size\",\"units\":\"screen\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2222\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"2173\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"2230\",\"type\":\"Selection\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"2212\",\"type\":\"BoxAnnotation\"}],\"root_ids\":[\"2246\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"0d199c12-53e6-43de-b83a-64a1116c0e7d\",\"root_ids\":[\"2246\"],\"roots\":{\"2246\":\"21c89374-b10e-42b6-b7c3-92c40cd1b9c9\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "2246"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "show(gridplot(figures,ncols=2,plot_width=200,plot_height=200))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* figuregure：可以选择绘制图形\n",
    "* show（）展示\n",
    "* gridplot（）组合"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 散点图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"8a57154a-c77a-442c-a813-2e531eb34b4e\" data-root-id=\"2597\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"03a86e26-e436-4dda-84e5-45b455d7f1e8\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"2608\"}],\"center\":[{\"id\":\"2611\"},{\"id\":\"2615\"}],\"left\":[{\"id\":\"2612\"}],\"plot_height\":300,\"plot_width\":300,\"renderers\":[{\"id\":\"2633\"}],\"title\":{\"id\":\"2598\"},\"toolbar\":{\"id\":\"2623\"},\"x_range\":{\"id\":\"2600\"},\"x_scale\":{\"id\":\"2604\"},\"y_range\":{\"id\":\"2602\"},\"y_scale\":{\"id\":\"2606\"}},\"id\":\"2597\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"axis\":{\"id\":\"2608\"},\"ticker\":null},\"id\":\"2611\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"2616\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"2617\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"2726\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"data\":{\"x\":[1,2,3,4,5],\"y\":[6,7,8,9,3]},\"selected\":{\"id\":\"2728\"},\"selection_policy\":{\"id\":\"2729\"}},\"id\":\"2630\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"2724\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"overlay\":{\"id\":\"2622\"}},\"id\":\"2618\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"2600\",\"type\":\"DataRange1d\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"navy\"},\"line_alpha\":{\"value\":0.5},\"line_color\":{\"value\":\"navy\"},\"size\":{\"units\":\"screen\",\"value\":20},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2631\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"2609\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"2604\",\"type\":\"LinearScale\"},{\"attributes\":{\"axis\":{\"id\":\"2612\"},\"dimension\":1,\"ticker\":null},\"id\":\"2615\",\"type\":\"Grid\"},{\"attributes\":{\"formatter\":{\"id\":\"2724\"},\"ticker\":{\"id\":\"2613\"}},\"id\":\"2612\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"2619\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"2729\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"2602\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"2606\",\"type\":\"LinearScale\"},{\"attributes\":{\"source\":{\"id\":\"2630\"}},\"id\":\"2634\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"navy\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"navy\"},\"size\":{\"units\":\"screen\",\"value\":20},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2632\",\"type\":\"Scatter\"},{\"attributes\":{\"formatter\":{\"id\":\"2726\"},\"ticker\":{\"id\":\"2609\"}},\"id\":\"2608\",\"type\":\"LinearAxis\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"2622\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"2616\"},{\"id\":\"2617\"},{\"id\":\"2618\"},{\"id\":\"2619\"},{\"id\":\"2620\"},{\"id\":\"2621\"}]},\"id\":\"2623\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"2728\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"2620\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"2621\",\"type\":\"HelpTool\"},{\"attributes\":{\"text\":\"\\u6563\\u70b9\\u56fe\\u793a\\u4f8b1\"},\"id\":\"2598\",\"type\":\"Title\"},{\"attributes\":{\"data_source\":{\"id\":\"2630\"},\"glyph\":{\"id\":\"2631\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"2632\"},\"selection_glyph\":null,\"view\":{\"id\":\"2634\"}},\"id\":\"2633\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"2613\",\"type\":\"BasicTicker\"}],\"root_ids\":[\"2597\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"03a86e26-e436-4dda-84e5-45b455d7f1e8\",\"root_ids\":[\"2597\"],\"roots\":{\"2597\":\"8a57154a-c77a-442c-a813-2e531eb34b4e\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "2597"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = [1,2,3,4,5]\n",
    "y = [6,7,8,9,3]\n",
    "p= figure(title = \"散点图示例1\",plot_width=300,plot_height=300)\n",
    "\n",
    "p.scatter(x,y,\n",
    "         size = 20,\n",
    "         marker=\"circle\",color=\"navy\",alpha=0.5)  #alpha透明度\n",
    "show(p)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 气泡图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"b167d614-614c-4543-bc87-a398a774635e\" data-root-id=\"2779\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"7e340454-04fe-4a7c-b466-75139ea84f8a\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"2790\"}],\"center\":[{\"id\":\"2793\"},{\"id\":\"2797\"}],\"left\":[{\"id\":\"2794\"}],\"plot_height\":300,\"plot_width\":300,\"renderers\":[{\"id\":\"2815\"}],\"title\":{\"id\":\"2780\"},\"toolbar\":{\"id\":\"2805\"},\"x_range\":{\"id\":\"2782\"},\"x_scale\":{\"id\":\"2786\"},\"y_range\":{\"id\":\"2784\"},\"y_scale\":{\"id\":\"2788\"}},\"id\":\"2779\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"2786\",\"type\":\"LinearScale\"},{\"attributes\":{\"axis\":{\"id\":\"2794\"},\"dimension\":1,\"ticker\":null},\"id\":\"2797\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"2919\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"2916\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"2782\",\"type\":\"DataRange1d\"},{\"attributes\":{\"data_source\":{\"id\":\"2812\"},\"glyph\":{\"id\":\"2813\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"2814\"},\"selection_glyph\":null,\"view\":{\"id\":\"2816\"}},\"id\":\"2815\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"2798\"},{\"id\":\"2799\"},{\"id\":\"2800\"},{\"id\":\"2801\"},{\"id\":\"2802\"},{\"id\":\"2803\"}]},\"id\":\"2805\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"2784\",\"type\":\"DataRange1d\"},{\"attributes\":{\"overlay\":{\"id\":\"2804\"}},\"id\":\"2800\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"2798\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"2795\",\"type\":\"BasicTicker\"},{\"attributes\":{\"formatter\":{\"id\":\"2916\"},\"ticker\":{\"id\":\"2791\"}},\"id\":\"2790\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"2799\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"2801\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"2803\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"2788\",\"type\":\"LinearScale\"},{\"attributes\":{\"formatter\":{\"id\":\"2914\"},\"ticker\":{\"id\":\"2795\"}},\"id\":\"2794\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"2802\",\"type\":\"ResetTool\"},{\"attributes\":{\"data\":{\"size\":[10,12,14,16],\"x\":[1,2,3,4],\"y\":[2,4,6,8]},\"selected\":{\"id\":\"2918\"},\"selection_policy\":{\"id\":\"2919\"}},\"id\":\"2812\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"source\":{\"id\":\"2812\"}},\"id\":\"2816\",\"type\":\"CDSView\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"2804\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"2791\",\"type\":\"BasicTicker\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"navy\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"navy\"},\"line_width\":{\"value\":2},\"size\":{\"field\":\"size\",\"units\":\"screen\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2814\",\"type\":\"Scatter\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"navy\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"navy\"},\"line_width\":{\"value\":2},\"size\":{\"field\":\"size\",\"units\":\"screen\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2813\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"2918\",\"type\":\"Selection\"},{\"attributes\":{\"axis\":{\"id\":\"2790\"},\"ticker\":null},\"id\":\"2793\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"2914\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"text\":\"\\u6c14\\u6ce1\\u56fe\"},\"id\":\"2780\",\"type\":\"Title\"}],\"root_ids\":[\"2779\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"7e340454-04fe-4a7c-b466-75139ea84f8a\",\"root_ids\":[\"2779\"],\"roots\":{\"2779\":\"b167d614-614c-4543-bc87-a398a774635e\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "2779"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x=[1,2,3,4]\n",
    "y=[2,4,6,8]\n",
    "\n",
    "sizes = [10,12,14,16]\n",
    "p = figure(title=\"气泡图\",plot_width=300, plot_height=300)\n",
    "\n",
    "p.scatter(x, y, marker=\"circle\", size=sizes, color=\"navy\",line_width=2,alpha=0.2)\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"b6ff001c-e343-4e76-8f61-e8505eeb799a\" data-root-id=\"1002\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"a91a383c-3787-4a8a-adff-de5b0aa84980\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1013\"}],\"center\":[{\"id\":\"1016\"},{\"id\":\"1020\"}],\"left\":[{\"id\":\"1017\"}],\"plot_height\":300,\"plot_width\":300,\"renderers\":[{\"id\":\"1038\"}],\"title\":{\"id\":\"1003\"},\"toolbar\":{\"id\":\"1028\"},\"x_range\":{\"id\":\"1005\"},\"x_scale\":{\"id\":\"1009\"},\"y_range\":{\"id\":\"1007\"},\"y_scale\":{\"id\":\"1011\"}},\"id\":\"1002\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"axis\":{\"id\":\"1017\"},\"dimension\":1,\"ticker\":null},\"id\":\"1020\",\"type\":\"Grid\"},{\"attributes\":{\"data\":{\"size\":[10,12,14,16],\"x\":[1,2,3,4],\"y\":[2,4,6,8]},\"selected\":{\"id\":\"1045\"},\"selection_policy\":{\"id\":\"1046\"}},\"id\":\"1035\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1005\",\"type\":\"DataRange1d\"},{\"attributes\":{\"text\":\"\\u6c14\\u6ce1\\u56fe\"},\"id\":\"1003\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1022\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"1007\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1011\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1014\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1009\",\"type\":\"LinearScale\"},{\"attributes\":{\"axis\":{\"id\":\"1013\"},\"ticker\":null},\"id\":\"1016\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1042\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"formatter\":{\"id\":\"1044\"},\"ticker\":{\"id\":\"1018\"}},\"id\":\"1017\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1018\",\"type\":\"BasicTicker\"},{\"attributes\":{\"overlay\":{\"id\":\"1027\"}},\"id\":\"1023\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1045\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1046\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"formatter\":{\"id\":\"1042\"},\"ticker\":{\"id\":\"1014\"}},\"id\":\"1013\",\"type\":\"LinearAxis\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"navy\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"navy\"},\"line_width\":{\"value\":2},\"size\":{\"field\":\"size\",\"units\":\"screen\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1037\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"1026\",\"type\":\"HelpTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1021\"},{\"id\":\"1022\"},{\"id\":\"1023\"},{\"id\":\"1024\"},{\"id\":\"1025\"},{\"id\":\"1026\"}]},\"id\":\"1028\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1021\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1024\",\"type\":\"SaveTool\"},{\"attributes\":{\"data_source\":{\"id\":\"1035\"},\"glyph\":{\"id\":\"1036\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1037\"},\"selection_glyph\":null,\"view\":{\"id\":\"1039\"}},\"id\":\"1038\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"navy\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"navy\"},\"line_width\":{\"value\":2},\"size\":{\"field\":\"size\",\"units\":\"screen\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1036\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"1025\",\"type\":\"ResetTool\"},{\"attributes\":{\"source\":{\"id\":\"1035\"}},\"id\":\"1039\",\"type\":\"CDSView\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1027\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"1044\",\"type\":\"BasicTickFormatter\"}],\"root_ids\":[\"1002\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"a91a383c-3787-4a8a-adff-de5b0aa84980\",\"root_ids\":[\"1002\"],\"roots\":{\"1002\":\"b6ff001c-e343-4e76-8f61-e8505eeb799a\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1002"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x=[1,2,3,4]\n",
    "y=[2,4,6,8]\n",
    "\n",
    "sizes = [10,12,14,16]\n",
    "p = figure(title=\"气泡图\",plot_width=300, plot_height=300)\n",
    "\n",
    "p.scatter(x, y, marker=\"circle\", size=sizes, color=\"navy\",line_width=2,alpha=0.2)\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
